<template>
	<view>
		<view v-if="staffs.state == 0">
			<view class="cu-steps">
				<view class="cu-item" :class="index>staffs.state?'':'text-green'" v-for="(item,index) in steps"
					:key="index">
					<text :class="'cuIcon-' + item.cuIcon"></text> {{item.name}}
				</view>
			</view>
			<view class="block__title">报修信息</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">报修人</view>
				<view class="text-gray">{{staffs.repairsPerson}}</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">报修小区</view>
				<view class="text-gray">{{staffs.communityName}}</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">报修位置</view>
				<view class="text-gray">{{staffs.place}}</view>
			</view>
			
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">工单编码</view>
				<view class="text-gray">{{staffs.workOrderNum}}</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">状态</view>
				<view class="text-gray">待处理</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">报修内容</view>
				<view class="text-gray">{{staffs.repairsMatter}}</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">预计处理时间</view>
				<view class="text-gray">{{staffs. appointmentTime}}</view>
			</view>
		</view>

		<view v-if="staffs.state == 1">
			<view class="cu-steps">
				<view class="cu-item" :class="index>staffs.state?'':'text-green'" v-for="(item,index) in steps"
					:key="index">
					<text :class="'cuIcon-' + item.cuIcon"></text> {{item.name}}
				</view>
			</view>

			<view class="block__title">报修信息</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">报修人</view>
				<view class="text-gray">{{staffs.repairsPerson}}</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">报修小区</view>
				<view class="text-gray">{{staffs.communityName}}</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">报修位置</view>
				<view class="text-gray">{{staffs.place}}</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">工单编码</view>
				<view class="text-gray">{{staffs.workOrderNum}}</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">状态</view>
				<view class="text-gray">处理中</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">报修内容</view>
				<view class="text-gray">{{staffs.repairsMatter}}</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">开始处理时间</view>
				<view class="text-gray">{{staffs.startTime}}</view>
			</view>
		</view>

		<view v-if="staffs.state == 2">
			<view class="cu-steps">
				<view class="cu-item" :class="index>staffs.state?'':'text-green'" v-for="(item,index) in steps"
					:key="index">
					<text :class="'cuIcon-' + item.cuIcon"></text> {{item.name}}
				</view>
			</view>

			<view class="block__title">报修信息</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">报修人</view>
				<view class="text-gray">{{staffs.repairsPerson}}</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">报修小区</view>
				<view class="text-gray">{{staffs.communityName}}</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">报修位置</view>
				<view class="text-gray">{{staffs.place}}</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">工单编码</view>
				<view class="text-gray">{{staffs.workOrderNum}}</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">状态</view>
				<view class="text-gray">已处理</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">报修内容</view>
				<view class="text-gray">{{staffs.repairsMatter}}</view>
			</view>
			<view class="flex margin-top-xs justify-between">
				<view class="text-gray">处理结束时间</view>
				<view class="text-gray">{{staffs.endTime}}</view>
			</view>
		</view>


	</view>
</template>

<script>
	import context from '../../lib/java110/Java110Context.js';
	const constant = context.constant;
	const factory = context.factory;
	import conf from '../../conf/config.js'
	import viewImage from '@/components/view-image/view-image.vue'
	export default {
		data() {
			return {
				steps: [{
					cuIcon: 'usefullfill',
					name: '待维修',
					desc: ''
				}, {
					cuIcon: 'radioboxfill',
					name: '维修中',
					desc: ''
				}, {
					cuIcon: 'roundcheckfill',
					name: '已维修',
					desc: ''
				}],
				active: 2,
				viewImage: false,
				viewImageSrc: '',
				staffs: [],
				repairId: '',
				communityId: '',
				imgUrlPre: '',
			}
		},
		components: {
			viewImage
		},
		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad: function(options) {
			let that = this;
			context.onLoad(options);
			// that.repairId = options.poolId.state;
			that.staffs = JSON.parse(options.poolId)
			console.log("that.staffs", that.staffs)

			//加载报修类型
			// this._loadRepairStaffs();
		},
		methods: {
			_loadRepairStaffs: function() {
				let _communityInfo = context.getCurrentCommunity();
				let _that = this;
				let dataObj = {
					page: 1,
					row: 50,
					communityId: _communityInfo.communityId,
					repairId: this.repairId
				};
			},
			preview: function(e) {
				let _url = e.target.dataset.url;
				this.$refs.viewImageRef.showThis(_url);
			}
		}
	}
</script>
<style scoped lang="scss">
	@import "@/pagesB/my/myHouseDetail.css";

	text {
		text-align: center;
	}

	.block__title {
		margin: 0;
		font-weight: 400;
		font-size: 14px;
		color: rgba(69, 90, 100, .6);
		padding: 40rpx 30rpx 20rpx;
	}

	.bottomRegion {
		width: 100%;
		height: 100rpx;
		position: fixed;
		bottom: 20rpx;
		display: flex;
		justify-content: center;
		align-items: center;

		.vacantHouse {
			margin: 20rpx;
			width: 50%;
			text-align: center;
			height: 60rpx;
			float: left;
			font-size: 26rpx;
			line-height: 60rpx;

			button {
				font-size: 26rpx;
				height: 70rpx;
				margin-top: 15rpx;
				line-height: 70rpx;
				border-radius: 40rpx 40rpx;
			}
		}

		.removeBind {
			margin: 20rpx;
			width: 50%;
			height: 60rpx;
			float: right;
			text-align: center;
			font-size: 26rpx;
			line-height: 60rpx;

			button {
				font-size: 26rpx;
				height: 70rpx;
				margin-top: 15rpx;
				line-height: 70rpx;
				border-radius: 40rpx 40rpx;
			}
		}
	}

	/deep/ .margin-top-xs {
		margin: 15rpx 30rpx;
	}
</style>
